<?php
include_once 'mysql_connect.php';
if(isset($_GET['uid_mess']))
{
	$uid_mess=explode(',',$_GET['uid_mess']);
	$uid=$uid_mess['0'];
	$fid=$uid_mess['1'];
	$mess=$uid_mess['2'];
}
if(isset($_GET['fid']))
{
	$fid=explode(',',$_GET['fid']);
	$uid=$fid['0'];
	$fid=$fid['1'];
}
$photo=mysql_query("SELECT `photo` FROM `bbs_member_infor` WHERE `uid`='$uid'");
$photo=mysql_fetch_array($photo);
$photo=$photo['photo'];

$infor=mysql_query("SELECT `class`,`username` FROM `bbs_member` WHERE `uid`='$uid'");
$infor=mysql_fetch_array($infor);
$class=$infor['class'];
switch($class)
{
	case 1: $classn='会员'; break;
	case 2: $classn='高级会员'; break;
	case 3: $classn='白金会员'; break;
	case 4: $classn='版主'; break;
	case 5: $classn='管理员'; break;
}
$username=$infor['username'];
if($class=='4')
{
	$forum=mysql_query("SELECT * FROM `bbs_forum` WHERE `fmanage`='$username'");
	$forum=mysql_fetch_array($forum);
	$fname=$forum['fname'];
	$fmanage=$forum['fmanage'];
}
$new_members=mysql_query("SELECT `uid`,`username` FROM `bbs_member` order by uid desc");
$new_members=mysql_fetch_array($new_members);
$new_member=$new_members['username'];
$max_uid=$new_members['uid'];

//---Forum Select---//
$forum_infor=mysql_query("SELECT `fname`,`fdescription`,`ftopics`,`fmanage` FROM `bbs_forum` WHERE `fid`='$fid'");
$forum_infor=mysql_fetch_array($forum_infor);
$fname=$forum_infor['fname'];
$fdescription=$forum_infor['fdescription'];
$fmanage=$forum_infor['fmanage'];
//---Topic Select---//
$topic_infor=mysql_query("SELECT `tid`,`uid`,`father_tid`,`title`,`ip`,`dateline`,`topic_img` FROM `bbs_topic` WHERE `fid`='$fid' order by `tid` desc");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $fname;?>版块区</title>
</head>

<body>
&nbsp;<img src="<?php echo $photo;?>"  width="50" height="50"/><font color="blue"><?php if($class==4 && $fmanage){echo "<font color=red>$fname</font>版块的";}echo $classn;?></font>:<a href="my_zone.php?uid=<?php echo $uid;?>" /><font color="red">&nbsp;<?php echo $username;?></a></font>

<?php
/*开设版块的权限*/
if($class>=4){?>&nbsp;&nbsp;
<a href="show.php?forum=<?php echo $uid_c="$uid,$class";?>" />
<font color=green>开设版块</a></font>&nbsp;<?php }
/*删除ID的权限*/
if($class>=5){?>&nbsp;&nbsp;
<a href="show.php?delete_id=<?php echo $uid_c="$uid,$class";?>" />
<font color=green>删除ID</a></font>&nbsp;<?php } echo "<font color=green>$mess</font>";?><hr />




<!--主题发布-->

<form action="show.php?topic_uid=<?php echo $uid_fid="$uid,$fid";?>" method="post">
<table border="1">
	<tr>
		<td align="left"><input type="submit" name="fatie" value="发帖" /></td>
	</tr>
</table>
</form>

<hr />
<!--主题显示-->
<table border="1">
	<tr>
		<td width="211">主题</td>
		<td width="129">作者</td>
		<td width="169">时间</td>
		<td width="156">ip</td>
	</tr>
<?php 
while($row=mysql_fetch_array($topic_infor))
{	
	$fuid=$row['uid'];
	$username=mysql_query("SELECT `username` FROM `bbs_member` WHERE `uid`='$fuid'");
	$username=mysql_fetch_array($username);
	$username=$username['username'];	
	date_default_timezone_set('Asia/Shanghai');//亚洲上海时区
	$time=$row['dateline'];
	@$time=date("Y-m-d G:i:s",$time);
?>
	<tr>
		<td><img src="<?php echo $row['topic_img'];?>" /><a href="topic.php?topic_infor=<?php echo $uid.",".$row['tid'];?>" /><?php echo $row['title'];?></td>
		<td><?php echo $username;?></td>
		<td><?php echo $time;?></td>
		<td><?php echo $row['ip'];?></td>
	</tr>

<?php
}
?>
</table>
</body>
</html>
